package com.practice.Stream流使用;

import java.util.Arrays;
import java.util.List;
import java.util.Optional;

/**
 * Created by IntelliJ IDEA2022.3.2
 * @Author: Tenghw
 * @Date: 2023/03/03  14:48
 * @Description: 顺序流转为并行流
 */
@SuppressWarnings("all")
public class Demo1 {
    public static void main(String[] args) {
        List<Integer> list = Arrays.asList(1,2,6,8,9);
        Optional<Integer> findFirst = list.stream().parallel().filter(x -> x>6).findFirst();
        System.out.println(findFirst);//8
    }
}
